Skip to content

Fix pcl_cc_tool_interface library build configuration#6377

Open
sumir0 wants to merge 3 commits into
PointCloudLibrary:masterfrom
sumir0:fix/pcl_cc_tool_interface-pic
Open

Fix pcl_cc_tool_interface library build configuration#6377
sumir0 wants to merge 3 commits into
PointCloudLibrary:masterfrom
sumir0:fix/pcl_cc_tool_interface-pic

Conversation

@sumir0
Copy link
Copy Markdown
Contributor

@sumir0 sumir0 commented Dec 11, 2025

  • Set PIC property for pcl_cc_tool_interface target in CMake

* Add `PIC` property for `pcl_cc_tool_interface` target in CMake

Signed-off-by: Ramir Sultanov <sumir0@proton.me>
* Change setter of `PIC` property for `pcl_cc_tool_interface` target in CMake

Signed-off-by: Ramir Sultanov <sumir0@proton.me>
@sumir0
Copy link
Copy Markdown
Contributor Author

sumir0 commented Dec 11, 2025

Current build configuration produces the following error on my linux platform:

[ 49%] Automatic MOC and UIC for target pcl_cc_tool_fpfh_estimation
[ 49%] Built target pcl_cc_tool_fpfh_estimation_autogen
[ 49%] Building CXX object apps/cloud_composer/CMakeFiles/pcl_cc_tool_fpfh_estimation.dir/pcl_cc_tool_fpfh_estimation_autogen/mocs_compilation.cpp.o
[ 49%] Building CXX object apps/cloud_composer/CMakeFiles/pcl_cc_tool_fpfh_estimation.dir/tools/fpfh_estimation.cpp.o
[ 49%] Linking CXX shared library ../../lib/cloud_composer_plugins/libpcl_cc_tool_fpfh_estimation.so
/usr/bin/ld: ../../lib/libpcl_cc_tool_interface.a(cloud_item.cpp.o): warning: relocation against `_ZN3pcl6traits4nameINS_12_PointXYZRGBENS_6fields1yELi0EE5valueE' in read-only section `.text._ZN3pcl13createMappingINS_11PointXYZRGBEEEvRKSt6vectorINS_13PCLPointFieldESaIS3_EERS2_INS_6detail12FieldMappingESaIS9_EE[_ZN3pcl13createMappingINS_11PointXYZRGBEEEvRKSt6vectorINS_13PCLPointFieldESaIS3_EERS2_INS_6detail12FieldMappingESaIS9_EE]'
/usr/bin/ld: ../../lib/libpcl_cc_tool_interface.a(mocs_compilation.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN3pcl14cloud_composer15PropertiesModel16staticMetaObjectE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [apps/cloud_composer/CMakeFiles/pcl_cc_tool_fpfh_estimation.dir/build.make:209: lib/cloud_composer_plugins/libpcl_cc_tool_fpfh_estimation.so.1.15.1.99] Error 1
make[1]: *** [CMakeFiles/Makefile2:9741: apps/cloud_composer/CMakeFiles/pcl_cc_tool_fpfh_estimation.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

At the moment I can not confirm neither necessity, neither the lack of necessity of pcl_cc_tool_interface to be a static library in recent versions of PCL. But these changes will fix the error.

…target

* Add condition for setting `PIC` property for `pcl_cc_tool_interface` target

Signed-off-by: Ramir Sultanov <sumir0@proton.me>
@mvieth mvieth added module: apps changelog: fix Meta-information for changelog generation labels Mar 13, 2026
Copy link
Copy Markdown
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good idea, thank you.

@mvieth mvieth requested a review from larshg March 13, 2026 13:14
@larshg
Copy link
Copy Markdown
Contributor

larshg commented Mar 18, 2026

Could you elaborate a bit @sumir0 - since it is already building on both 20.04, 22.04 and 24.04 on our CI before this?

@mvieth
Copy link
Copy Markdown
Member

mvieth commented Mar 18, 2026

I have seen it fail a few times on the ubuntu-variety CI: https://dev.azure.com/PointCloudLibrary/pcl/_build?definitionId=15 So far it only happened when gcc was used. Might also be related to CMAKE_BUILD_TYPE?

@mvieth
Copy link
Copy Markdown
Member

mvieth commented Mar 20, 2026

@larshg I did a few more tests, and it is probably not related to the chosen value of CMAKE_BUILD_TYPE. Instead, I found that the error happens with gcc when Qt6 is used, but not when Qt5 is used (everything else kept the same, VTK build from source both times). I don't know why this is the case, but then it is clear why the error only appears on the ubuntu-variety CI: because only there, PCL is built with gcc+Qt6. The regular "Build" CI uses gcc+Qt5 or MSVC+Qt6 or Clang on macOS + Qt6

@sumir0
Copy link
Copy Markdown
Contributor Author

sumir0 commented Mar 21, 2026

Thank you for tests and #6415! I couldn't figure out the reason to why CI doesn't fail and my build fails at the time. But now reading your comments I think it is indeed somehow caused by the fact that I build PCL with GCC and Qt6

@mvieth
Copy link
Copy Markdown
Member

mvieth commented May 19, 2026

@larshg I would propose that we merge this PR soon. I know that you started #6415 which could make this one unnecessary, but currently that PR does not build successfully and I don't know how long it will take until that one is ready? So I think it would be good to merge this one as soon as possible to have the PCL apps build successfully on Ubuntu 26.04 again. And when #6415 is ready, we can still merge that one for the other fixes it provides.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: fix Meta-information for changelog generation module: apps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants